﻿namespace Sidvall.WorkItemManager.Data
{
    public class SensorValue
    {
        #region Public Members

        #region Name

        private string _Name;
        public string Name
        {
            get
            {
                return _Name;
            }
            set
            {
                value = Sidvall.Business.ValidationManager.GetValidString(value, false, 50);
                _Name = value;
            }
        }

        #endregion
        #region Value

        private string _Value;
        public string Value
        {
            get
            {
                return _Value;
            }
            set
            {
                value = Sidvall.Business.ValidationManager.GetValidString(value, false, 50);
                _Value = value;
            }
        }

        #endregion
        #region ValueTimestamp

        private System.DateTime? _ValueTimestamp;
        public System.DateTime? ValueTimestamp
        {
            get
            {
                return Sidvall.Business.ValidationManager.GetValidDateTime(_ValueTimestamp);
            }
            set
            {
                value = Sidvall.Business.ValidationManager.GetValidDateTime(value, System.DateTimeKind.Utc);
                _ValueTimestamp = value;
            }
        }

        #endregion

        #region ToString

        public override string ToString()
        {
            return this.Name;
        }

        #endregion

        #endregion
    }
}
